<template>
	<view class="item" @click='itemClick'>
		<view class="cover">
			<image :src="item.courseCover" mode="aspectFill"></image>
		</view>
		<view class="inner">
			<view class="info">
				<image class="avatar" :src="item.courseImg" v-if="item.courseImg"></image>
				<view class="right" :style="!item.courseImg? 'width:100%':''">
					<view class="title">
						<view class='course'>{{item.courseName}}(共{{item.resourcesNum}}节) </view>
						<text style="color: #33a3f8;font-size: 30rpx;font-weight: bold;">
							{{item.isBuy==0?item.buyResourcesNum:item.resourcesNum}}/{{item.resourcesNum}}
						</text>
					</view>
					<view class="contents">
						{{item.courseSynopsis}}
					</view>
				</view>
			</view>
			<view class="teacher">
				<view class="left">
					<text>讲师：</text>
					<view>{{item.realName}}</view>
				</view>
				<view class="right">
					<view class="flex">
						<image src="https://yzxk.oss-cn-hangzhou.aliyuncs.com/images/eyes.png" mode="aspectFit"></image>
						<text>{{item.watchNum}}</text>
					</view>
					<view class="flex">
						<image src="https://yzxk.oss-cn-hangzhou.aliyuncs.com/images/good.png" mode="aspectFit"></image>
						<text>{{item.greatNum}}</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'list',
		props: {
			item: Object
		},
		data() {
			return {

			}
		},
		methods: {
			itemClick() {
				this.$emit('clickItem',this.item)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.item {
		position: relative;
		height: 250rpx;
		margin: 0 auto;
		border-radius: 20rpx;
		margin-bottom: 24rpx;
		overflow: hidden;
		.cover {
			width: 100%;
			height: 100%;
			opacity: .4;

			image {
				width: 100%;
				height: 100%;
			}
		}

		.inner {
			position: absolute;
			top: 0;
			left: 0;
			right: 0;
			padding: 28rpx;
			.info {
				display: flex;
				margin-bottom: 13rpx;
				.avatar {
					width: 160rpx;
					height: 160rpx;
					border-radius: 10rpx;
					margin-right: 16rpx;
				}
				.right {
					font-size: 30rpx;
					font-family: Source Han Sans CN;
					font-weight: 500;
					color: #111111;
					display: flex;
					flex-direction: column;
					// justify-content: space-between;

					.title {
						width: 100%;
						display: flex;
						justify-content: space-between;
						.course {
							width: 420rpx;
							overflow: hidden;
							text-overflow: ellipsis;
							white-space: nowrap;
						}
					}

					.contents {
						width: 470rpx;
						margin-top: 20rpx;
						font-size: 24rpx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #5F5F5F;
					}
				}


			}

			.teacher {
				// margin-top: 13rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				font-family: Source Han Sans CN;
				font-size: 26rpx;

				.left {
					display: flex;
					align-items: center;
					color: #656565;

					&>text {
						color: #1C1C1C;
					}
				}

				.right {
					display: flex;
					align-items: center;

					.flex {
						padding-left: 40rpx;
						display: flex;
						align-items: center;
						font-size: 24rpx;
						color: #656565;

						&>image {
							width: 30rpx;
							height: 20rpx;
							margin-right: 4rpx;
						}
					}
				}
			}
		}
	}
</style>
